home *** CD-ROM | disk | FTP | other *** search
/ Hyper Stacks 1994 May / Hyper Stacks (Pacific HiTech)(1994)[Mac].iso / Utilities / HyperTalk Help / HyperTalk Help.rsrc / TEXT_-16000_HT Help.txt < prev    next >
Encoding:
Text File  |  1994-04-30  |  17.6 KB  |  467 lines

  1. HYPERTALK GUIDE
  2.  
  3. REFERRING TO OBJECTS
  4.  
  5.     -- An object mentioned in an <expr> can be anywhere in the
  6.             same stack; only go may mention cds|bgs of another stack,
  7.             and stack properties may refer to a non-open stack
  8.     -- Legal chunks are: char, word, item, line, fld | button, cd, bg
  9.     -- Ordinals are: number; first-tenth, last; mid; any;
  10.                 next; prev; this
  11.     -- If text is hilited in a field, there is a legal container
  12.             called the selection which you can use or manipulate
  13.     -- An object mentioned in an <expr> can involve me (meaning,
  14.             the object where the handler lives); or the target (meaning,
  15.             the object that received the message) [but target refers 
  16.             to a field's contents]
  17.     -- Constants are true, false, up, down, empty, quote, 
  18.             return, space, comma, colon, tab, formfeed, linefeed
  19.     -- Contents types (for is a) are number, integer, point,
  20.             rect, date, logical
  21.  
  22. PROPERTIES
  23.  
  24.     can (mostly) be set; "the" not required (outside msg)
  25.     NB: You can always use a property or a chunk of a property as
  26.             an entity of the same type (e.g. a number) in any expression
  27.             (you do not have to get it first)
  28.  
  29.                  ‚Ä¢ = cannot be set; ¬∂ = can only be set (no get!);
  30.                 * = reverts to default when handler ends;
  31.                 ¬ß = there is a shortcut command (see below)
  32.  
  33. GLOBAL (no "of"):
  34.     UserPrefs:
  35.         blindTyping, powerkeys, textArrows <boolean>
  36.         userLevel <num>
  37.         userModify <boolean> {overrides locking to let changes be made,
  38.             but they are discarded on closeCard}
  39.     Parsing:
  40.         itemDelimiter <char>
  41.     Display:
  42.         ¬∂*cursor <name> {watch, busy, hand, arrow, ibeam, cross, plus}
  43.                 (but nothing is to stop you from adding your own)
  44.         *dragSpeed <num> {bigger is faster, except that 0 is fastest}
  45.         longWindowTitles <boolean>
  46.         scriptTextFont <name>, scriptTextSize <points>,
  47.             traceDelay <ticks>
  48.     Suppression:
  49.         ¬ß*lockScreen <boolean> {won't prevent msg appearing!}
  50.         *lockMessages <boolean> {will prevent msg appearing!}
  51.         *lockRecent, ¬ß*lockErrorDialogs <boolean>
  52.     Calculation:
  53.         *numberFormat <str> {0 = must fill; # = may fill}
  54.             {def "0.######"}
  55.     ¬ßPrinting:
  56.         printMargins <rect> {72=1 inch};
  57.         printTextAlign {left|center|right}; printTextFont <name>;
  58.         printTextSize, printTextHeight {in points};
  59.         printTextStyle <styleList>
  60.     ¬ßPainting:
  61.         brush, linesize, pattern <num>;
  62.         centered, filled, grid, multiple <boolean>;
  63.         multiSpace, polySides <num>;
  64.         textAlign, textFont, textSize, textHeight, textStyle
  65.     Lists:
  66.         ‚Ä¢stacksInUse <ret list>
  67.         ‚Ä¢address <zone:machine:program> {of HC on the network}
  68.         ‚Ä¢[long] version {of HC}
  69.             returns 4 packed 2-digit numbers: major vers, minor vers,
  70.             software state (80 = final), release
  71.  
  72. OF WINDOW:
  73.     Variable Watcher:
  74.         hBarLoc, vBarLoc <num>
  75.     Message Watcher:
  76.         hideIdle, hideUnused <boolean>;
  77.         ¬∂nextLine, ¬∂text <expr> {for debugging}
  78.     Palette:
  79.         ‚Ä¢buttonCount <num>; ‚Ä¢commands <ret list>
  80.         hilitedButton <num> {hilites that button; 0 to turn all off}
  81.     External Windows (Picture):
  82.         globalLoc <pt>, globalRect <rect>; dithering <boolean>;
  83.         scale <-5..5>; zoom <in|out>
  84.         ‚Ä¢pictureWidth, pictureHeight <num>
  85.     External Windows and Cd Window:
  86.         scroll <pt> {the pt that is to be the new topLeft}
  87.     All:
  88.         ‚Ä¢properties <comma-list>
  89.             {for some reason, not with cd window}
  90.         ‚Ä¢owner
  91.             {also a way to discover type; besides HyperCard,
  92.             typical owners are Picture and Palette, or any picture-
  93.             making external}
  94.  
  95. OF FLD:
  96.         autoTab, dontSearch, dontWrap, fixedLineHeight,
  97.             lockText, showLines, wideMargins, sharedText <boolean>
  98.         style <transparent | opaque | rectangle | shadow | scrolling>
  99.         scroll <num> {pixels, not lines or anything helpful like that!}
  100. OF BTN:
  101.         hilite, autoHilite, sharedHilite, showName <boolean>;
  102.         style <transparent | opaque | rectangle | shadow | roundRect |
  103.             checkBox | radioButton>; icon <name|num>;
  104. OF FLD OR BTN:
  105.         textAlign, textFont, textHeight, textSize, textStyle
  106. OF WINDOW, FLD, OR BTN:
  107.         ¬ßloc <pt> {topLeft of a window, centre of fld/btn}; 
  108.         rect <rect>; left, top, right, bottom <num>;
  109.         topLeft, botRight <pt>; 
  110.             NB: measured by cd window, but cd window by screen
  111.         width, height <num>
  112.             {can be set for cd window, but ‚Ä¢not other windows}
  113.         ¬ßvisible {boolean};
  114. OF CD:
  115.         ¬ßmarked <boolean>
  116.             NB: a card also has properties rect etc.; this is really
  117.                 a stack feature, the maximal cd window dimensions
  118. OF CD OR BG:
  119.         ¬ßshowPict <boolean>
  120. OF WINDOW, FLD, BTN, CD, OR BG:
  121.         ‚Ä¢id <num>
  122.                 but a card's id starts with "card id", and there is a
  123.                 long id that gives much more info (also short id)
  124.         ‚Ä¢number <num> {front to back or start to finish sequence}
  125. OF STACK {need not be open!}:
  126.         cantAbort, cantModify, cantPeek <boolean>
  127.         ‚Ä¢size, ‚Ä¢freesize <num>; ‚Ä¢version
  128.             gives a five-item list: creator version HC, compactor
  129.                 version HC, oldest modifier since compaction, most recent
  130.                 modifier, time of most recent modification (for format of
  131.                 first four, see global Version, above) 
  132. OF CD, BG, OR STACK:
  133.         cantDelete <boolean>
  134. OF FLD, BTN, CD, BG, OR STACK:
  135.         script <str>
  136. OF MENUITEM:
  137.         markChar <char>; checkMark <boolean>; ¬ßenabled <boolean>;
  138.         menuMsg <msg>
  139. OF NEARLY ANYTHING:
  140.         name <str> (‚Ä¢cannot be set for windows)
  141.             for stacks and their objects the reported name includes an
  142.             identifying prefix (e.g. "card field"); long name gives much
  143.             more info, short name just the name
  144.  
  145. FUNCTIONS
  146.  
  147.     cannot be set; "the" required before or () after
  148.     ["the F of X" legal only if there is exactly one param]
  149.         Confusing, eh? e.g., why "the stacksInUse" is a (non-settable)
  150.         Property, but "the windows" is a (non-settable) Function, or why
  151.         "the number of" can be a Property OR a Function, is a Mystery!
  152.  
  153. MOUSE AND FIELD-TEXT SELECTION:
  154.         mouse <up | down>; mouseClick <boolean>
  155.         mouseH, mouseV, mouseLoc <pt> {current}
  156.             clickH, clickV, clickLoc <pt> {at last click}
  157.         clickChunk, selectedChunk, foundChunk <"char x to y
  158.             of card|bkgnd field z">; {if x > y, cursor is after y}
  159.         clickLine, selectedLine, foundLine <"line x of ...>;
  160.         clickText, selectedText, foundText <word | grouped text>;
  161.         selectedField, foundField <"card|bkgnd field z">;
  162.         selectedLoc <pt> {the left bottom (!) of the selected text}
  163.  
  164. KEYS:
  165.         commandKey, optionKey, shiftKey <up | down>
  166.  
  167. TEXT:
  168.         length(str); offset(findStr,inStr) <num>
  169.         charToNum(char); numToChar(num)
  170.  
  171. CHUNKS AND OBJECTS:
  172.         number(<chunk expr> | <obj expr>)
  173.             the <chunk expr> must name a container too (including
  174.             "menuItems of menu"); the <obj expr> usually must not mention
  175.             any larger entity, and refers to current card/stack --
  176.                 except that you can say "cds of <bg expr>"
  177.  
  178. MATH:
  179.         random(num) <num between 1 and given num>
  180.         annuity(rate, numPeriods); compound(rate, numPeriods)
  181.         abs(num); average(list); max(list); min(list)
  182.         sin(), cos(), tan(), atan();
  183.         sqrt(); exp(); exp1() {exp(x)-1}; exp2() {2**x}
  184.         ln(); ln1() {ln(x+1)}; round(); trunc()
  185.  
  186. GLOBAL AND ENVIRONMENT:
  187.         [abbr] | [long] date; [long] time; secs; ticks
  188.         sound {Done if no sound is playing; else name of sound}
  189.         tool <x tool>; menus, windows, programs <ret list>;
  190.         screenRect <rect>;
  191.         diskSpace, heapSpace, stackSpace, systemVersion
  192.  
  193. SPECIAL:
  194.         value(<expr>) {forces extra level of evaluation}
  195.         param(num); paramCount; params <comma-list>
  196.             {param(0) is the message (handler name); 
  197.             params lists all, starting with 0. These are needed only
  198.             if you don't know in advance how many params will arrive}
  199.  
  200. SYSTEM MESSAGES
  201.  
  202. [About the hierarchy: only btns, flds, and cds are
  203.   sent messages; but if unused they then travel to
  204.     cd, bg, stack, stacks in use, home, and HC;
  205.     also, if handler contains a go, then to new cd, bg, etc.
  206. (You insert/remove a stack from the hierarchy with
  207. start|stop using stack <name>;
  208. StacksInUse stack handlers are consulted newest first.)]
  209.  
  210. Sending Order for Complex Events:
  211. startup/resume absolutely first
  212. all destructions (closes and deletes) precede
  213.      all creations (news and opens)
  214. all closes precede all deletes; all news precede all opens
  215. all same things (e.g. new) are sent together;
  216.     if destructive, concerning card, bg, stack;
  217.     if constructive, concerning stack, bg, card
  218.  
  219. startup, quit
  220. suspendStack, resumeStack {is stack frontmost in HC?}
  221.         NB not sent if you switch apps in MultiFinder; if your
  222.         stack needs to know if it is running in the background
  223.         it can check the suspended
  224. suspend, resume
  225.         for launch/return of app from HC: but not sent under
  226.         multifinder / system 7
  227. openStack, openBackground, openCard, openField
  228. closeStack, closeBackground, closeCard,
  229.     exitField, closeField
  230.     {exitField if no change (since openField), else closeField}
  231. newStack, newBackground, newCard,
  232.  newField, newButton
  233. deleteStack, deleteBackground, deleteCard,
  234.     deleteField, deleteButton
  235. mouseEnter, mouseWithin, mouseLeave {flds & btns}
  236. mouseDown, mouseStillDown, mouseUp
  237.     {flds, btns, and cards! hence a card can "be" a button}
  238. enterInField, ReturnInField
  239. moveWindow, sizeWindow, close {card window}
  240.         NB: further information about all of the above can be
  241.         derived by checking the target
  242.  
  243. openPalette, openPicture, 
  244.     closePalette, closePicture (params: name, id)
  245. mouseDownInPicture, mouseUpInPicture (params: name, xy)
  246. keyDown, commandKeyDown (param: char)
  247.     [keyDown distinguishes case; command doesn't]
  248.     keyDown not sent if commandKey is down; but it is sent before:
  249. returnKey, enterKey, tabKey,
  250.     arrowKey (param: direction),
  251.     controlKey (param: ascii code),
  252.     functionKey (param: which)
  253. idle
  254. choose [the second param is the toolNum]
  255. doMenu (params: itemName, menuName)
  256. errordialog (param: errorMessage)
  257.         {sent if error when lockErrorDialogs is True}
  258. appleEvent (params: class, id, sender)
  259. ...and commands (put, get, go, etc.) count as messages! (but keywords
  260.     such as send, repeat, etc., do not)
  261.  
  262. Handlers are of the form on <msg> [paramList]
  263. Intercepted messages can be let thru with pass <msg>
  264. You can (re)direct messages with the command
  265.     send <msg> to <obj expr>
  266. (Observe that Hypercard is an object; hence you can force
  267. handlers to be bypassed)
  268.  
  269. COMMAND SYNTAX
  270.  
  271. CONTAINER/PROPERTY MANIPULATION:
  272. put <expr> [into | after | before <cont>] {default is msg}
  273. delete <chunk of cont>
  274.         "put/delete" smart about chunks, e.g. will add/cut nec delims
  275. add|subtract|multiply|divide ... to|from|by ...
  276.         the thing affected must be a <[chunk of] cont>, but what affects it
  277.             may be any <expr>
  278. get <expr> {= put <expr> into it}
  279. set <prop> [of <obj>] to <expr>
  280. set property shortcuts:
  281.     reset paint {properties to def}
  282.     reset printing {ditto}
  283.     lock screen; unlock screen [with <visual>]
  284.     enable | disable [menuItem <name|num>] of menu <name|num>
  285.     lock | unlock error dialogs
  286.         (see also Showing and Hiding, Marking, below)
  287.  
  288. SIMULATING USER ACTIONS:
  289. select [before | after] <chunk expr>|text of <fld expr>
  290.         NB select by word/line will not include the
  291.          space/cr after (must use char for that)
  292.         To just place the insertion pt after char n of a fld, 
  293.             use "select char n+1 to n of..."
  294. select <btn|fld expr>
  295. choose <name> tool; choose tool <num>
  296. click at <pt> [with <modkey>[, <modkey>[, <modkey>]]]
  297. drag from <pt 1> to <pt 2> [with <modkey1>[, etc.]]
  298.         <modkey> = shiftKey | optionKey | commandKey
  299. type <str expr> [with commandKey]
  300. doMenu <menuItemText>[, <menuTitle>] [without dialog]
  301.         {you can still do this even if you have deleted a standard
  302.         menu, though you cannot in that case use command-type}
  303. create stack <name> [with <bg expr>] [in new window]
  304. save <stackname> as <stackname2> {need not be current stack}
  305.  
  306. SHOWING & HIDING:
  307. picture [<name>[,<type>[,<style>[,<vis?>[<bitDepth>]]]]]
  308.         <type> = file {default}, resource, clipboard
  309.         <style> = plain, zoom {def}, document,  roundrect {true windows};
  310.                 windoid, roundrect, shadow, dialog 
  311.                     {these sit in back of palette layer, right over card
  312.                     (and all but windoid are immobile); but they don't move if
  313.                     user moves card window!}
  314.         <bitDepth> (1-32) causes offscreen buffer copy; 0 forces none
  315. palette <name>[, <loc>]
  316.         NB you cannot precache a palette (but you can use offscreen loc)
  317.         -- Note that picture and palette create, and what they create
  318.         are thereafter windows
  319. close <window expr>
  320.         <window expr> = cd window | window <name> | <num> | <id>
  321. hide titlebar | menubar | <window|btn|fld expr>
  322. show titlebar | menubar | <window|btn|fld expr> [at <loc>]
  323.         here, <window expr> includes std titles (msg, tool window, etc.)
  324.         NB loc for cd window is measured from screen corner
  325. show|hide cd|bg pict; show|hide pict of <cd|bg expr>
  326.         the second type affects unseen cards in same stack
  327. show|hide groups
  328.  
  329. MARKING, FINDING & SORTING:
  330. [un]mark all cds | cds where <boolean expr> |
  331.     cds by finding <str> [in <fld expr>]
  332. find [whole|word|chars|string] <str> [in <fld expr>]
  333.     a) spaces regarded as delimiting separate strings:
  334.         normal: there are words beginning w/ every given str
  335.         word: the given words all appear as words
  336.         chars: the chars that make up each str all appear
  337.     b) spaces regarded as part of a single str:
  338.         string: the full string appears
  339.         whole: the full string appears at word-boundaries
  340. sort [marked] cds [of <bg expr>] [<how>] by <expr>
  341. sort lines | items of <cont> [<how>]
  342.         <how> = [ascending | descending]
  343.                 [text | numeric | international | datetime]
  344.         default is ascending and it figures out its own value
  345.         the by <expr> is what about each cd we are to evaluate
  346. NB: no need to test for existence of <fld> in any of these!
  347.  
  348. DIALOGS:
  349. answer <prompt> [with <btn1> [or <btn2> [or <btn3>]]]
  350.         default <btn1> is "OK"; last btn is hilited
  351. answer file <prompt> [of type <type> [or <type2> [or...]]]
  352.         standard <type>s are stack, text, application, picture,
  353.             paint; otherwise use file type code
  354. answer program <prompt> of type <type>
  355.         to choose from programs running now on the net
  356. ask [file] <prompt> [with <default reply>]
  357.         you can distinguish an empty reply from Cancel; the result
  358.             will be Cancel if the user presses Cancel
  359. ask password [clear] <prompt> [with <default reply>]
  360.  
  361. MENUS:
  362. create menu <name>
  363. delete [menuItem <name|num> of] menu <name|num>
  364. put <itemList> before|into|after [menuItem <name|num> of]
  365.     menu <name|num> [with menuMsg <msgList>]
  366.             {in <itemList> use "-" for grey line}
  367.             a msg "doMenu ItemName" is always sent; if no doMenu handler
  368.                 traps it, or if it traps but passes it, then the custom msg is
  369.                 sent, if any; if none, HC responds with its internal handler. So,
  370.                 for a standard menu, you can add something to the start of the
  371.                 standard response, or just totally change the response
  372. reset menubar
  373.  
  374. NAVIGATING:
  375. go <cd | bg | stack expr [w/ stack: "in a new window"]>
  376.         The cd|bg expr may include stack expr for a different stack.
  377.         -- NB: numerical marked cd exprs are valid cd exprs (first
  378.             marked cd, marked cd 7); but a bug (?) causes such exprs
  379.             to default to the first cd even if no cds are marked. To get
  380.             around this, test for "next marked cd", which works correctly
  381. push [this | recent {meaning previous viewed}] cd
  382. pop cd [into | before | after <cont> {fetches cd id and stack name}
  383. show <cardinal num> | all | marked cds
  384.  
  385. COMMUNICATING:
  386. open file <name>
  387.         {must open before you can read or write}
  388. read from file <name> until <char>|eof
  389. read from file <name> [at <pos>] for <num> {of chars}
  390. write <expr> to file <name> [at <pos>|eof]
  391. close file <name> {done reading or writing}
  392.  
  393. print <expr> {string or equivalent}
  394. open printing [with dialog] {to let user pick format}
  395. open report printing [with dialog | template <name>]
  396. print all | marked | <cardinal num> cds
  397. print cd | <cd expr> [from <pt> to <pt>]
  398. close printing
  399.  
  400. open [<doc> with] <app> {launches}
  401. print <doc> with <app>
  402. close <app>
  403.         {careful! don't type Close "Finder" into msg box now!!! STOP!}
  404. close <doc> with <app> {only if apple-event savvy}
  405. send <scriptname> to program <name> [without reply]
  406. request <exprToEvaluate> from program <name>
  407. request ae data [keyword <expr>]
  408.         for use upon receipt of an appleEvent; the default (no
  409.             keyword) is the "direct object" (keyword "----")
  410. reply [error] <expr> [keyword <expr>] {to the sender}
  411.  
  412. import paint from file <name>; export paint to file <name>
  413. dial <num> [with <modem commands>]
  414.  
  415. SPECIAL EFFECTS:
  416. visual <effect name> [<speed>] [to <color>] {next time cd changes}
  417.         <effect name> = plain; zoom open / close {from/to clickloc};
  418.         zoom in / out; iris open / close; barn door open /close;
  419.         wipe / scroll right / left / up / down; dissolve; checkerboard;
  420.         venetian blinds; shrink to/from top/center/bottom
  421.         <speed> = [very] slow | fast
  422.          <color> = black, white, gray, inverse, card
  423. flash [<num flashes>]
  424. beep [<num beeps>]
  425. wait <num> [ticks|seconds]; wait until|while <boolean expr>
  426. play <snd resource name> [tempo <speed>] ["<notes>"]
  427.         included are Harpischord, Flute, Boing; or play stop to kill
  428.         200 is a moderate tempo
  429.         notes are abcdefg [#|b] with octave (4=middle), or 60 = middle C
  430.         durations are whqest (whole-thirtysecond) [.|3]
  431.         duration and octave remain in effect until altered
  432.         NB: play <name> 0 = preload
  433. edit script of <obj expr>
  434. convert <date expr> to <date format>
  435.         formats are: seconds, long date, short date, abbreviated date,
  436.          long time, short time, dateItems
  437.  
  438. NEW (2.1) FEATURES
  439.  
  440. CONSTANTS:
  441.     comma, colon
  442. WINDOWS:
  443.     properties are: loc, visible, name, number, ID, owner
  444.     OPENPICTURE and OPENPALETTE now send ID as well as name
  445. GLOBAL PROPERTIES, FUNCTIONS:
  446.     the lockErrorDialogs, set by (un)lock error dialogs
  447.        (in this mode, errorDialog is sent to card on error)
  448.     the itemDelimiter (usually comma)
  449.     the address (of HyperCard on the network)
  450.     the programs (gives ret-list of running programs)
  451.     the systemVersion
  452. READ and WRITE:
  453.     read/write at <BYTENUM>, where eof is a valid BYTENUM
  454.     read until eof (and the 16K limit is gone)
  455. DIALOGS:
  456.     answer program <PROMPT> lets choose running progs on net
  457. and of course, APPLE EVENTS‚Ķ!
  458.  
  459. -------------------------------------------
  460.  
  461. Sources: HyperCard Help Stack; HyperTalk Reference Stack;
  462. Danny Goodman, The Complete HyperCard 2.0 Handbook;
  463. John Kevin Calhoun, HyperCard 2.1 Release Notes;
  464. and lots of poking around and experimenting
  465.  
  466.  
  467.